package com.hopu.v1.controller.front.personal;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hopu.v1.pojo.common.R;
import com.hopu.v1.pojo.question.ErrorNotebooksQuestions;
import com.hopu.v1.service.front.personal.FErrQuestionService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 我的错题
 */
@RestController
@RequestMapping("api/v1/front/errQuestions")
public class FErrQuestionController {

    @Resource
    private FErrQuestionService errQuestionService;

    /**
     * 学生错题查询
     * @return
     */
    @GetMapping
    public R getErrQuestions(Page<ErrorNotebooksQuestions> page,String studentId){
        System.out.println("page = " + studentId);
        QueryWrapper<ErrorNotebooksQuestions> queryWrapper = new QueryWrapper<>();
        //id要根据前端传
        queryWrapper.eq("student_id",studentId);
        return R.ok(errQuestionService.page(page,queryWrapper));
    }
}
